"use client";
import React, { useImperativeHandle } from "react";
import ImageViewer from "./image-viewer";
import VideoViewer from "./video-viewer";
interface IProps {
    type: string;
    name?: string;
    src: string;
    footer?: React.ReactNode;
    onSwipe?: (dir: "left" | "right") => void;
}
const MediaViewer: React.ForwardRefRenderFunction<never, IProps> = (
    props,
    forwardedRef
) => {
    const { name, type, src } = props;
    useImperativeHandle(forwardedRef, () => null);
    if (type === "Image") {
        return <ImageViewer name={name} src={src} />;
    }
    if (type === "Video") {
        return <VideoViewer src={src} />;
    }
    return (<div>不支持类型</div>) as never;
};
export default React.memo(React.forwardRef(MediaViewer));
